package com.phiture.erp.produce.core.listener;

import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import com.phiture.erp.basic.api.pojo.resp.ErpMaterialResp;
import com.phiture.erp.basic.api.pojo.resp.ErpUserCustomizeConfigResp;
import com.phiture.erp.basic.api.service.ErpMaterialApi;
import com.phiture.erp.basic.api.service.ErpUserCustomizeConfigApi;
import com.phiture.erp.common.constants.ErpUserCustomizeConfigKeyConstants;
import com.phiture.erp.common.enums.ErpAuditStatus;
import com.phiture.erp.common.enums.ErpMaterialAttrEnum;
import com.phiture.erp.common.enums.ErpStockRecordBizTypeEnum;
import com.phiture.erp.produce.core.event.ProduceInEvent;
import com.phiture.erp.produce.core.pojo.vo.ErpProductionTaskMaterialVO;
import com.phiture.erp.produce.core.service.ErpProduceInService;
import com.phiture.erp.produce.core.service.ErpProductionTaskService;
import com.phiture.erp.produce.dal.entity.ErpProduceInDO;
import com.phiture.erp.produce.dal.entity.ErpProduceInItemsDO;
import com.phiture.erp.produce.dal.entity.ErpProductionTaskDO;
import com.phiture.erp.stock.api.pojo.req.ErpStockOutReq;
import com.phiture.erp.stock.api.service.ErpStockOutReqApi;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.core.annotation.Order;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Slf4j
@Component
@RequiredArgsConstructor
public class ErpProduceInListener {



    private final ErpProduceInService erpProduceInService;
//    private final ErpMaterialApi erpMaterialApi;
//    private final ErpStockOutReqApi erpStockOutReqApi;
//    private final ErpUserCustomizeConfigApi erpUserCustomizeConfigApi;
//    private final ErpProductionTaskService erpProductionTaskService;

    @Order(1)
    @EventListener(ProduceInEvent.class)
//    @Async
    public void handleBackFlushWhenProduceIn(ProduceInEvent event) {
        log.info("inItemsDOList:{},approve:{}", event.getInItemsDOList(), event.isApprove());
//        erpProduceInService.doBackFlushWhenProduceIn(event.getInItemsDOList(), event.isApprove());
    }


}
